NewMemoryBlock Function

Returns a new MemoryBlock class object of the size specified. Used for dealing with raw memory on any platform for Declare statements, for sending information over sockets and serial devices, and miscellaneous uses that require direct access to memory.

Syntax

result = NewMemoryBlock( size )


Parameters

size

Integer

The size (in bytes) of the new memory block.


It can be used with pointer parameters of shared library entry points.


Notes

Use the NewMemoryBlock function to create an empty MemoryBlock class object that can be used to pass data to a shared library entry point or return data from an entry point.

If the application doesn't have sufficient memory to allocate to the memory block, Nil is returned. Check for Nil before proceeding.


Example

The following example creates a 384 byte MemoryBlock, whose bytes are numbered 0 to 383:

Dim m as MemoryBlock
m=NewMemoryBlock (384)
If m = Nil then
  Beep
  MsgBox "Insufficient memory to continue."
else
//proceed normally
end if

See Also

MemoryBlock class; Nil keyword.